/*
 * PaymentBO.java
 *
 * Created on March 7, 2007, 1:16 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package Data;

/**
 *
 * @author Danny Beutler
 */
public class PaymentBO {
    private String id;
    private double amount;
    private double change;
    private String type;
    private TransactionBO transaction;
    private boolean alreadyInDB=false;
    private boolean dirty =true;
    /** Creates a new instance of PaymentBO */
    public PaymentBO(String GUID) {
        this.id=GUID;
    }
    
    /** Gets the payment GUID */
    public String getId() {
        return id;
    }
    
    /** Gets the payment amount */
    public double getAmount() {
        return amount;
    }
    
    /** Sets the payment amount */
    public void setAmount(double amount) {
        dirty=true;
        this.amount = amount;
    }
    
    /** Gets the payment change */
    public double getChange() {
        return change;
    }
    
    /** Sets the payment change */
    public void setChange(double change) {
        dirty=true;
        this.change = change;
    }
    
    /** Gets the payment type */
    public String getType() {
        return type;
    }
    
    /** Sets the payment type */
    public void setType(String type) {
        dirty=true;
        this.type = type;
    }
    
    /** Gets the payment transaction */
    public TransactionBO getTransaction() {
        return transaction;
    }
    
    /** Sets the payment transaction */
    public void setTransaction(TransactionBO transaction) {
        dirty=true;
        this.transaction = transaction;
    }
    
    /** Gets the payment alreadyInDB Variable */
    public boolean isAlreadyInDB() {
        return alreadyInDB;
    }
    
    /** Sets the payment alreadyInDB */
    public void setAlreadyInDB(boolean alreadyInDB) {
        this.alreadyInDB = alreadyInDB;
    }
    
    /** Gets the payment isDirty*/
    public boolean isDirty() {
        return dirty;
    }
    
    /** Sets the payment dirty variable */
    public void setDirty(boolean dirty) {
        this.dirty = dirty;
    }

    //Calculate the change due
    public double calculateChange() {
        change = amount - transaction.getTotal();
        return change;
    }
    
    
    
}
